package com.yinxin.wudasuanfa.huaweiod;

import java.util.ArrayList;

/**
 * @author yinxin
 * @version 1.0
 * @Description: 求"asdfasdfas"的子集到"fas"的最小开始索引
 * @date 2022/5/1220:12
 */
public class Exercise0 {
    public static void main(String[] args) {
        String str ="asdfasdfas";
        String strson ="fas";
        for (int i = 0; i < str.length()-strson.length(); i++) {
            if(isson(str,strson,i)){
                System.out.println(i+1);
                break;
            }
        }
    }

    private static boolean isson(String str, String strson,int i) {
        for (int j = i; j < i+strson.length(); j++) {
            if(str.charAt(i)==strson.charAt(j-i)){
                return false;
            }
        }
        return true;
    }
}
